package com.cfpl.admin_service.controller;

import com.cfpl.admin_service.VO.AdminPlantLocationList;
import com.cfpl.admin_service.service.PlantingLocationService;
import com.cfpl.admin_service.service.VegetableVarietyService;
import com.cfpl.project_common.pojo.VegetableVariety;
import com.cfpl.project_common.result.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: LYP
 * @Date: 2023/10/24 - 11:28
 * @Description: com.cfpl.admin_service.controller
 * @version: 1.0
 * 查询数据字典控制器
 */
@RestController
@RequestMapping("/data/dictionary")
@Api(tags = "数据字典相关接口")
@Slf4j
public class DictionaryController {

    @Autowired
    private PlantingLocationService plantingLocationService;

    //查询当前用户所在公司的种植地点
    @GetMapping("/queryPlantLocationList")
    @ApiOperation("查询当前用户所在公司的种植地点列表")
    public BaseResult<List<AdminPlantLocationList>> queryDicOfPlantLocation(){
        List<AdminPlantLocationList> locationLists = plantingLocationService.queryDicOfPlantLocation();
        return BaseResult.ok(locationLists);
    }

    @Autowired
    private VegetableVarietyService vegetableVarietyService;

    /**
     * 查询果蔬种类集合
     */
    @ApiOperation("查询果蔬种类集合")
    @GetMapping("/queryDicOfVegetableVariety")
    public BaseResult<List<VegetableVariety>> queryDicOfVegetableVariety(){
        List<VegetableVariety> vegetableVarieties = vegetableVarietyService.queryVegetableVarietyList();
        return BaseResult.ok(vegetableVarieties);
    }



}
